<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<jsp:useBean id="ProduitService" scope="session" class="controle.service.ProduitService">
</jsp:useBean>

<jsp:useBean id="UtilisateurService" scope="session" class="controle.service.UtilisateurService">
</jsp:useBean>
<%=session.getAttribute("login_infor") %>
<%
   request.setCharacterEncoding("GBK");
   String [][]detail = new String[0][8];
   if(session.getAttribute("InputDetail")!=null){
   detail = (String[][])session.getAttribute("InputDetail");

   }
   else if(request.getAttribute("rechercherPar") == "administrateur" ){
	  String administrateur=(String)request.getAttribute("trouver");
   detail = UtilisateurService.getUtilisateurParAdministrateur(administrateur);
  
   }
   else{
	   detail = UtilisateurService.getUtilisateur();
   }

   
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//fr">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Page Utilisateur</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="Mon page web">
	


  </head>
  
  <body><div align="center"><br></div><div align="center"> 
    </div><center>
    <h3 style="background-color: rgb(0, 0, 0);"><font size="6" color="#ff0000">Afficher Utilisateur</font></h3>

    <form method="post" action="servlet/ControleUtilisateur">
       <input name="idsLength" type="hidden" value="<%=detail.length %>"/>
       <table cellpadding="7" cellspacing="0" border="1" style="background-color: rgb(192, 192, 192);">
	       <tr align="center">
	       	  <td style="background-color: rgb(192, 192, 192);">   </td>
	       	  <td style="background-color: rgb(192, 192, 192);">Login<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Password</td>
	          <td style="background-color: rgb(192, 192, 192);">Email<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Nom<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Prenom<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Adresse<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Telephone<br></td>
	          <td style="background-color: rgb(192, 192, 192);">Administrateur</td>
	  
	          
	   
	          
	        
	        
	        </tr>
	       
	        
	      <%for(int i=0;i<detail.length;i++){ %>
	       <tr align="center">
	      <td>
	      	<input type="checkbox" name="macheckbox" value="<%=i%>" >
	      </td>
	       <td><input name="data1_<%=i %>" type="text" size="15" value="<%=detail[i][0] %>" readonly="readonly"></td> <!--login  --> 
	       <td><input name="data2_<%=i %>" type="text" size="15" value="<%=detail[i][1] %>"></td> <!-- password -->
	       <td><input name="data3_<%=i %>" type="text" size="15" value="<%=detail[i][2] %>"></td> <!-- mail -->	
	       <td><input name="data4_<%=i %>" type="text" size="15" value="<%=detail[i][3] %>"></td><!-- nom -->
	       <td><input name="data5_<%=i %>" type="text" size="15" value="<%=detail[i][4] %>"></td><!--  prenom-->
	       <td><input name="data6_<%=i %>" type="text" size="15" value="<%=detail[i][5] %>"></td><!-- adresse -->
 		   <td><input name="data7_<%=i %>" type="text" size="15" value="<%=detail[i][6] %>"></td> <!-- tel -->
	       <td><input name="data8_<%=i %>" type="text" size="15" value="<%=detail[i][7] %>"></td> <!-- administrateur -->

	       </tr>
	       <%} %>
	       
	      
	       <tr align="center">
			   <td colspan="12" align="center">
			   *<input type="submit" name="action" value="Mettre a jours utilisateur"/>
			   <input type="submit" name="action" value="Inscrire Utilisateur"/>
			   *<input type="submit" name="action" value="Supprimer Utilisateur"/>
			   <input type="submit" name="action" value="Raffraichir la page"/>
			   <input type="submit" name="action" value="Afficher Produit"/>
			   <strong >*Cocher la ou les cases avant l'operation</strong>
			   </td>
			</tr>
			
			
			<tr align="center">
			    <td colspan="12" align="center">
			    <input type="submit" name="action" value="Retour la page accueill"/>
			   *<input type="submit" name="action" value="Chercher Par Administrateur"/>
			   <strong >*Entrez 0 ou 1</strong>
			   <input type="text" name="chercher" />	    
	 		   
	      
			   </td>
		</tr>

	
    </table>
    		
		<% 
		if (request.getAttribute("miseajour") == "vrai" ){
			out.println("<font color=red  ><h3> Mise a jours reussie</h3> </font>");
		}
		if (request.getAttribute("supprimer") == "vrai" ){
			out.println("<font color=red  ><h3> Suppression reussie</h3> </font>");
		}
				
		%>
		

    
    </form>

    </center>
  </body>
</html>
